#load omnibus dataframe
omnibus_df <- read_delim("../data/processed/omnibus/omnibus_raw.csv",
delim = ",",
col_types = cols(.default = col_double(),
type = col_factor(),
ppid = col_factor(),
exp_label = col_factor(),
experiment = col_factor(),
hand = col_factor(),
camera_tilt = col_factor(),
surface_tilt = col_factor(),
target = col_factor(),
test_type = col_factor(),
prior_anim = col_factor(),
baseline_block = col_factor(),
task_type = col_factor(),
surface = col_factor(),
anim_type = col_factor()))
original_exps <- c("rot15_cued_tilt", "rot15_uncued", "tilt_uncued_rot",
"tilt_uncued_norot", "tilt_cued_rot", "tilt_cued_norot")
test_ppt <- 3
test_df <- omnibus_df %>% filter(ppid == test_ppt)
trial <- 250
trial_df <- filter(test_df, trial_num == trial)
x <- trial_df$flick_velocity_x
y <- trial_df$flick_velocity_y
z <- trial_df$flick_velocity_z
x2 <- trial_df$flick_direction_x
y2 <- trial_df$flick_direction_y
z2 <- trial_df$flick_direction_z
# plot both
plot_ly(x = c(0, x), y = c(0, y), z = c(0, z), type = "scatter3d", mode = "lines") %>%
add_trace(x = c(0, x2), y = c(0, y2), z = c(0, z2), type = "scatter3d", mode = "lines") %>%
layout(scene = list(xaxis = list(title = "x"),
yaxis = list(title = "y"),
zaxis = list(title = "z")))
# note: this is a rotated trial
# plot distribution of error_size
p <- ggplot(omnibus_df, aes(x = error_size)) +
geom_histogram(binwidth = .5) +
theme_minimal() +
theme(text = element_text(size = 11)) +
labs(x = "Error Size (cm)", y = "Count")
p
# try just animate_surface exp
animate_surface_trial_summary_df <- omnibus_df %>%
filter(exp_label == "animate_surface") %>%
group_by(prior_anim, block_num, trial_num_in_block, trial_num) %>%
summarise(
mean_deviation = mean(throw_deviation),
ci_deviation = vector_confint(throw_deviation)
)
`summarise()` has grouped output by 'prior_anim', 'block_num', 'trial_num_in_block'. You can override using the `.groups` argument.
data <- animate_surface_trial_summary_df
# set up plot
p <- data %>%
ggplot(
aes(
x = trial_num, y = mean_deviation,
ymin = mean_deviation - ci_deviation,
ymax = mean_deviation + ci_deviation
)
) +
theme_classic() +
theme(legend.position = "none") +
labs(
x = "Trial Number",
y = "Throw Angle (°)"
)
# add horizontal lines
p <- p +
geom_hline(
yintercept = c(0, -30), linewidth = 0.4,
colour = "#CCCCCC", linetype = "solid"
) +
geom_hline(
yintercept = c(-15), linewidth = 0.4,
colour = "#CCCCCC", linetype = "dashed"
)
# p <- p +
# scale_y_continuous(
# limits = c(-10, 35),
# breaks = c(0, 15, 30),
# labels = c(0, 15, 30)
# ) +
# scale_x_continuous(
# limits = c(0, 180),
# breaks = c(0, 60, 120, 180),
# labels = c(0, 60, 120, 180)
# )
# set font size to 11
p <- p +
theme(text = element_text(size = 11))
# repeat for prior_anim == "half", "full" and "wait"
for (unique_prior_anim in unique(data$prior_anim)) {
# get the data for this block
to_plot_data <- filter(data, prior_anim == unique_prior_anim)
# loop through the unique blocks in to_plot_data
for (block in unique(to_plot_data$block_num)) {
# get the data for this block
block_data <- filter(to_plot_data, block_num == block)
# add the data, use the pallete_list to get the colour
p <- p + geom_ribbon(
data = block_data,
aes(fill = prior_anim),
colour = NA, alpha = 0.3
) + geom_line(
data = block_data,
aes(colour = prior_anim))
}
}
# # save
# if (save_plots) {
# ggsave(
# p,
# filename = "../plots/paper_figs/sr_30_training.pdf", device = "pdf",
# height = 4, width = 6
# )
# }
ggplotly(p)
# p
# rest of the exps
original_exps_trial_summary_df <- omnibus_df %>%
filter(exp_label == "original_exps") %>%
group_by(experiment, trial_num) %>%
summarise(
mean_deviation = mean(throw_deviation),
ci_deviation = vector_confint(throw_deviation)
)
data <- original_exps_trial_summary_df
# set up plot
p <- data %>%
ggplot(
aes(
x = trial_num, y = mean_deviation, colour = experiment
)
) +
theme_classic() +
theme(legend.position = "none") +
labs(
x = "Trial Number",
y = "Throw Angle (°)"
)
# add horizontal lines
p <- p +
geom_hline(
yintercept = c(0, -30), linewidth = 0.4,
colour = "#CCCCCC", linetype = "solid"
) +
geom_hline(
yintercept = c(-15), linewidth = 0.4,
colour = "#CCCCCC", linetype = "dashed"
)
# p <- p +
# scale_y_continuous(
# limits = c(-10, 35),
# breaks = c(0, 15, 30),
# labels = c(0, 15, 30)
# ) +
# scale_x_continuous(
# limits = c(0, 180),
# breaks = c(0, 60, 120, 180),
# labels = c(0, 60, 120, 180)
# )
# set font size to 11
p <- p +
theme(text = element_text(size = 11))
# add confidence intervals
p <- p + geom_ribbon(
aes(
ymin = mean_deviation - ci_deviation,
ymax = mean_deviation + ci_deviation,
fill = experiment
), colour = NA, alpha = 0.3
)
# add data
p <- p + geom_line()
# # save
# if (save_plots) {
# ggsave(
# p,
# filename = "../plots/paper_figs/sr_30_training.pdf", device = "pdf",
# height = 4, width = 6
# )
# }
ggplotly(p)
# p
ggplotly(plot_original_learning_curve(omnibus_path))
visible vs non-visible tilt doesn’t affect the 15-degree rotation condition. But affects all other conditions. So 15-degree rotation
ggplotly(plot_original_rebound(omnibus_path))
Plot all the trials and see if there are group effects.
all_throw_summary <- omnibus_df %>%
group_by(experiment, trial_num) %>%
summarise(mean = mean(error_size, na.rm = TRUE),
sd = sd(error_size, na.rm = TRUE),
ci = vector_confint(error_size),
n = n(), .groups = "drop")
p <- omnibus_df %>%
ggplot(aes(x = trial_num, y = error_size)) +
# geom_point(alpha = 0.04, aes(colour = experiment)) +
geom_ribbon(data = all_throw_summary,
aes(y = mean, ymin = mean-ci,
ymax = mean+ci, fill = experiment),
alpha = 0.3) +
geom_line(data = all_throw_summary,
aes(y = mean, colour = experiment)) +
theme_minimal() +
# scale_x_continuous(limits = c(205, 374)) +
NULL
# ggplotly(p)
p
# save plot
# ggsave(p, height = 9, width = 16, device = "svg", filename = "data/figs/all_throws.svg")
# ggplotly(plot_success_manifold_no_tilt())
plot_success_manifold_no_tilt()
ggplotly(plot_success_manifold_tilt())